package com.hyd.tweet.xmpp;

import com.google.appengine.api.xmpp.JID;
import com.google.appengine.api.xmpp.XMPPService;
import com.google.appengine.api.xmpp.XMPPServiceFactory;
import com.hyd.tweet.Application;

/**
 * (description)
 *
 * @author yiding.he
 */
public class XMPPUtils {

    private static final XMPPService XMPP_SERVICE = XMPPServiceFactory.getXMPPService();

    public static XMPPService getXMPP() {
        return XMPP_SERVICE;
    }

    /**
     * 邀请指定用户聊天
     *
     * @param account 邀请的 GTalk 帐号
     */
    public static void invite(String account) {
        String name = account.split("@")[0];
        getXMPP().sendInvitation(new JID(account), new JID(name + "@" + Application.getAppChatDomain()));
    }
}
